<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #canvas {
      border: 1px solid red;
      width: 400;
      height: 400;
    }
  </style>
</head>
<body>
  <canvas id="canvas">
    此浏览器不支持canvas
  </canvas>
  <script>
      const canvas = document.getElementById('canvas');
      const ctx = canvas.getContext("2d");
      ctx.fillStyle = "green";
      ctx.fillRect(0, 0, 200, 100)
  </script>
</body>
</html>